﻿@using Website.Models.Domain
@model Location
@{
    var regions = this.ViewData["Regions"] as List<Region>;
    string actionName = "CreateLocation";
    if (this.ViewData["CreateLocationActionName"] != null)
    {
        actionName = this.ViewData["CreateLocationActionName"] as string;
    }

}
@using (this.Html.BeginForm(actionName, "Locations", FormMethod.Post, new { id = "CreateLocationForm" }))
{
    <div class="error">@Html.ValidationSummary()</div>
    <div class="formBullet">
        Navn:
    </div>
    <div class="formEntry" >
        @Html.TextBoxFor(x => x.Name)
    </div>

    <div class="formBullet">
        Inden for 150km:
    </div>
    <div class="formEntry">
        @Html.CheckBoxFor(x => x.Within150Km)
    </div>

    <div class="formBullet">
        Region:
    </div>
    <div class="formEntry">
        <select name="RegionID">
            <option value="">Vælg en region</option>
            @foreach (Region reg in regions.OrderBy(x => x.Country.Name).ThenBy(x => x.Name))
            {
                <option value="@reg.ID">@reg.Country.Name - @reg.Name</option>
            }
        </select>
    </div>

    <div class="formBullet">
        Addresse - Att.:
    </div>
    <div class="formEntry">
        @Html.TextBoxFor(x => x.Address.Att)
    </div>

    <div class="formBullet">
        Addresse - Gade Navn:
    </div>
    <div class="formEntry">
        @Html.TextBoxFor(x => x.Address.StreetName)
    </div>

    <div class="formBullet">
        Addresse - Gade Nr.:
    </div>
    <div class="formEntry">
        @Html.TextBoxFor(x => x.Address.StreetNr)
    </div>

    <div class="formBullet">
        Addresse - Post nr.:
    </div>
    <div class="formEntry">
        @Html.TextBoxFor(x => x.Address.Zip)
    </div>

    <div class="formBullet">
        Addresse - By:
    </div>
    <div class="formEntry">
        @Html.TextBoxFor(x => x.Address.City)
    </div>

    <div class="buttonHolder">
        <input type="submit" value="Opret"/></div>
}